import java.util.*;

/**
 * @author LKQ
 * @date 2022/6/14 16:33
 * @description
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextLine()) {
            String S = sc.nextLine();
            String T = sc.nextLine();
            int[] cnt = new int[26];
            for (char c: T.toCharArray()) {
                cnt[c - 'a']++;
            }
            boolean flag = true;
            for (char c: S.toCharArray()) {
                if (cnt[c -'a'] <= 0) {
                    flag = false;
                    break;
                }
            }
            System.out.println(flag);
        }
    }
}
